package global

import "github.com/jinzhu/gorm"

var databaseConn *gorm.DB

// 初始化Db
func DbStart(username, password, databaseName string) error {
	db, err := gorm.Open("mysql", username + ":" + password + "@/" + databaseName + "?charset=utf8&loc=Local")
	if err != nil {
		return err
	}
	databaseConn = db
	return nil
}

// 获取Db连接对象
func GenDbConn() *gorm.DB {
	return databaseConn
}
